<template>
  <div>
    <div>{{ count }}</div>
    <button @click="changeCount">改数字</button>
    <div>{{ nickname }}</div>
    <button @click="changeName">改名称</button>
  </div>
</template>

<script setup>
import { ref, watch } from 'vue'
const count = ref(0)
const nickname = ref('zs')
const changeCount = () => {
  count.value++
}
const changeName = () => {
  nickname.value = 'ls'
}
watch(count, (newValue, oldValue) => {
  console.log(newValue, oldValue)
})
watch(nickname, (newValue, oldValue) => {
  console.log(newValue, oldValue)
})
</script>
